Robotics 1.0 Lesson Plan
Lesson: 5 - Make your own Piano.

Purpose:Students will create a simple digital piano using the capacitive touch pads (A1–A7) on the Circuit Playground Express (CPX) and play the tune “Where Is Thumbkin?” while learning about input (touch), output (sound), and arrays.

No. of. Classes

1 - Time : 1:30 minutes, maximum 4 students per group.

Materials Required
  • Desktop or Laptop computer
  • CPX Board
  • USB Cable - Micro USB
Prior knowledge
  • Familiarity with the CPX board
  • Basic Python coding using Mu Editor
  • Connecting CPX to a computer using a USB cable and Booting in CircuitPY Mode
Exercises

Exercise:1



Introduction to Arrays using Neopixels on the CPX


Click here to view the instructions and code

Exercise:2



Understanding baseline capacitance using A1 and an alligator clip


Click here to view the experiment to understand baseline capacitance


Click here to view the instructions and code

Exercise:3



Create a piano using touch pads A1–A7 and the speaker.


Click here to view code hints


Click here to view the connection diagrams

Solution



Here is the Solution:

  • Click here to see the Solution Video for Exercise 1
  • Click here to see the Solution Video for Exercise 2
  • Click here to see the Solution Document for Exercise 3
  • Click here to see the Solution Video for Exercise 3
  • Teacher's Instruction
    1. Introduce the objective of the activity.
    2. Ensure all required materials are ready (CPX, USB cable, Mu Editor)..
    3. Give a clear explanation of:
      • Capacitive touch detection on pads A1–A7
      • playing sound using cp.play_tone()
      • Using arrays to store musical notes
    4. Encourage optional enhancements such as: Different songs, Adding LED effects while notes play and Fast/slow tempo control
    5. What would happen if your touch input points to an array index that doesn’t exist?